package com.app.utils.impl.labour;

import com.app.utils.impl.IConsole;
import com.app.utils.impl.Strategy;
import com.zndroid.utils.XUtils;
import com.zndroid.utils.impl.CleanerUtil;

/**
 * Created by lzy on 2022/2/15.
 */
public class CleanerUtilStrategy extends Strategy {

    public CleanerUtilStrategy(IConsole iConsole) {
        super(iConsole);
    }

    @Override
    public void doing() {
        CleanerUtil util = XUtils.create().cleanerUtil();
        iConsole.console("getFormatSize", util.with(XUtils.getContext()).setType(CleanerUtil.DEFAULT).getFormatSize());
        iConsole.console("asyncClean", "doing");
        util.with(XUtils.getContext()).setType(CleanerUtil.DEFAULT).asyncClean(new CleanerUtil.ICleanCallBack() {
            @Override
            public void onCleaning(int progress) {
                iConsole.console("asyncClean", progress + "%");
            }

            @Override
            public void onCleanOK() {
                iConsole.console("asyncClean", "done");
            }
        });
    }
}
